
package com.market.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.market.bean.Supplier;
import com.market.dao.hibernate.GenericDaoHibernate;

/**
 * Data access object (DAO) for domain model class Supplier.
 * 
 * @see com.market.bean.Supplier
 * @author MyEclipse - Hibernate Tools
 */
public class SupplierDAO extends GenericDaoHibernate<Supplier, Long>  implements ISupplierDAO
{

    public SupplierDAO()
    {
        super();
    }
    
    public SupplierDAO(Class<Supplier> persistentClass)
    {
        super(persistentClass);
        // TODO Auto-generated constructor stub
    }

    private static final Logger log = LoggerFactory.getLogger(SupplierDAO.class);

    // property constants
    public static final String NAME = "name";

    public static final String ADDRESS = "address";

    public static final String ZIP = "zip";

    public static final String TEL = "tel";

    public static final String FAX = "fax";

    public static final String URL = "url";

    public static final String IMG = "img";

    public static final String DESCRIPTION = "description";

    protected void initDao()
    {
        // do nothing
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.market.dao.ISupplierDAO#findById(java.lang.Long)
     */
    public Supplier findById(long id)
    {
        log.debug("getting Supplier instance with id: " + id);
        try
        {
            Supplier instance = (Supplier)getHibernateTemplate().get("com.market.bean.Supplier", new Long(id));
            return instance;
        }
        catch (RuntimeException re)
        {
            log.error("get failed", re);
            throw re;
        }
    }
}
